package main

import (u "sun_package/utills"    //起了别名
	"sun_package/f1"
	"sun_package/dog"
	"fmt"
	_ "sun_package/need_init_func_only"
	_ "github.com/go-sql-driver/mysql"
	"database/sql"
	"time"
	// "sun_package/about_defer"
	// "sun_package/pointer"
	// "sun_package/args"
	// "sun_package/about_if"
	// "sun_package/closure"
	"sun_package/about_map"
	"sun_package/about_struct"
	// "sun_package/about_panic"
	"sun_package/about_interface"
)

func main()  {
	
	fmt.Println("---------------p1-p2-----------------")
	p1p2()
	fmt.Println("---------------p3------------------")
	p3()
	fmt.Println("---------------p4------------------")
	p4()
	// pointer.Test()
	// args.Test()
	// about_if.Test()
	// about_defer.Test1()
	// closure.Test()
	about_map.Test()
	about_struct.Test()
	// about_panic.Test()
	about_interface.Test()
}

func p1p2()  {  //导包 和  init方法
	u.Foo()
	u.F2()
	f1.F1()
	jack := dog.Dog{Age:3,Name:"jack",Feet:4}
	fmt.Println("结构体Dog imported from package dog",jack.Age,jack.Name,jack.Feet)
}




func p3()  {  //数据库登录
	db,err:= sql.Open("mysql","root:sjh920813(127.0.0.1:3306)/erp?charset=utf8",)
	if err != nil{
		fmt.Println("connnect failed")
		return 
	}
	fmt.Println("success",db)
}

func p4()  {
	a := time.Now()
	fmt.Println(a)
	fmt.Printf("%T\n",a)
}